fix: idempotent lifecycle ops#1303
Conversation
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
|
Hello, is there anything I can do to help move this PR forward? Such as creating a Issue to link to it? |
|
Hello, |
|
Hi @DominikPildner! We see the same behavior with SKE. Does this PR fix this aswell implicitly? I cannot see any SKE-Code touched. |
|
@karawedi good point, for the 404 Code check I only covered resources that I used in my tests. I now tried to find all similar places and applied the same fix. This depends on the API actually returning 404 though, which I did not test for the new changes. |
Description
Issue: #1338
This PR brings resource lifecycle operations in line with Terraform plugin framework best practices (see Read and Delete guidelines), to fix handling of missing resources:
Read with missing ID: When
Readis called beforeCreate(e.g. by tools that observe existing infrastructure), resource IDs that are server-assigned will be empty. Previously this caused API errors from requests with empty IDs. Now the resource is gracefully removed from state instead.Delete of already-deleted resource: When a resource has already been deleted outside of Terraform,
Deletenow handles the not-found response gracefully instead of returning an error.Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)